Conversation
…d in current code base)
📝 WalkthroughWalkthroughRemoves legacy witness encoding, refactors scroll-related import paths, adds a CLI "dump" feature that writes ProvingTask data to disk, updates prover asset/handler signatures, bumps workspace and Go module dependencies, and adds/updates multiple prover-e2e test configurations for Galileo variants. Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (main.rs)
participant Prover as ProverBuilder/OneShot
participant Dumper as Dumper (ProvingService)
participant FS as FileSystem
CLI->>Prover: invoke one_shot(task_id, task_type, dump_config)
Prover->>Dumper: prove(ProvingTask)
Dumper->>FS: write input_task.json or input_task.bin, agg_proofs.bin
FS-->>Dumper: write OK / error
Dumper-->>Prover: ProveResponse (Failed with optional message)
Prover-->>CLI: return exit status
(Note: colored rectangles not required for this simple flow.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ❌ 3❌ Failed checks (3 warnings)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Fix all issues with AI agents
In `@Cargo.toml`:
- Around line 17-23: Update the inline comment that currently reads "with openvm
1.4.2" to "with openvm 1.4.3" in the Cargo.toml workspace.dependencies block so
the comment matches the actual OpenVM version recorded in Cargo.lock; locate the
comment near the scroll-zkvm-prover/scroll-zkvm-verifier/scroll-zkvm-types
entries and change only the version number in that comment.
In `@crates/prover-bin/src/dumper.rs`:
- Around line 13-16: The Dumper struct's target_path is currently ignored by
dump(); update the Dumper::dump (and any related methods around lines 24-39) to
use the Dumper.target_path when creating/writing the output file: convert
target_path to a Path/PathBuf, ensure the parent directory exists
(create_dir_all if needed), join the intended filename to that path instead of
using the current working directory, and open/create the file at that joined
path for writing; also preserve existing json_mode logic and error handling when
writing to the computed target path.
In `@crates/prover-bin/src/main.rs`:
- Around line 60-61: Change the clap argument for the json flag to use
flag-style parsing by replacing the current default_value usage with action =
ArgAction::SetTrue for the json_mode field; locate the json_mode field
declaration in main.rs (the #[arg(long = "json", default_value = "false")]
json_mode: bool,) and update it to use #[arg(long = "json", action =
ArgAction::SetTrue)] json_mode: bool, and ensure ArgAction is in scope (same
pattern used by the version flag in this file).
- Around line 95-108: The Dump command currently calls
ProverBuilder::new(...).build().await and then ignores the boolean/result of
Arc::new(prover).one_shot(&[task_id], task_type.into()).await; modify the Dump
command path to check the returned Result/bool from one_shot (same as the Handle
path does), and if it indicates failure return or propagate an error to the CLI
(e.g., map_err/eyre::eyre! or bail). Locate the call site for one_shot in
main.rs and ensure you mirror the Handle flow: inspect the awaited value,
convert it to a useful error on failure, and propagate it up instead of
discarding it.
In `@tests/prover-e2e/mainnet-galileo/genesis.json`:
- Around line 23-25: The fork-time keys use inconsistent casing: change the
object keys "GalileoTime" and "GalileoV2Time" to lowerCamelCase "galileoTime"
and "galileoV2Time" so they match the rest of the fork-time fields (e.g.,
"feynmanTime", "darwinTime") and the JSON unmarshal expectation; update the keys
in the genesis JSON where "GalileoTime" and "GalileoV2Time" appear (replace with
"galileoTime" and "galileoV2Time") to restore correct fork activation parsing.
🧹 Nitpick comments (2)
tests/prover-e2e/mainnet-galileo/config.json (1)
8-11: Make the RPC endpoint configurable to improve E2E stability.The hardcoded
https://mainnet-rpc.scroll.ioendpoint lacks override mechanisms (no env vars, no CLI flags, no template substitution). E2E tests become brittle against rate limits and service outages. Consider adding environment variable support or command-line override forfetch_config.endpointso tests can point to controlled or local RPC nodes during CI and local development.crates/prover-bin/src/prover.rs (1)
33-35: Debug-mode skip is OK; consider clearer operator signal.Default
falsekeeps compatibility, but in debug mode stale/corrupt local files may be used. Consider logging the full local path (or a warning) to make this obvious in logs.Also applies to: 85-91
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (18)
Cargo.tomlcrates/libzkp/src/lib.rscrates/libzkp/src/proofs.rscrates/libzkp/src/tasks/batch.rscrates/libzkp/src/tasks/bundle.rscrates/libzkp/src/tasks/chunk.rscrates/prover-bin/Cargo.tomlcrates/prover-bin/src/dumper.rscrates/prover-bin/src/main.rscrates/prover-bin/src/prover.rscrates/prover-bin/src/zk_circuits_handler/universal.rstests/prover-e2e/mainnet-galileo/.make.envtests/prover-e2e/mainnet-galileo/config.jsontests/prover-e2e/mainnet-galileo/config.template.jsontests/prover-e2e/mainnet-galileo/genesis.jsontests/prover-e2e/sepolia-feynman/.make.envtests/prover-e2e/sepolia-feynman/00100_import_blocks.sqltests/prover-e2e/sepolia-feynman/genesis.json
💤 Files with no reviewable changes (3)
- tests/prover-e2e/sepolia-feynman/.make.env
- tests/prover-e2e/sepolia-feynman/00100_import_blocks.sql
- tests/prover-e2e/sepolia-feynman/genesis.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-16T02:09:51.657Z
Learnt from: noel2004
Repo: scroll-tech/scroll PR: 1736
File: crates/libzkp/src/verifier/universal.rs:35-45
Timestamp: 2025-09-16T02:09:51.657Z
Learning: The verify_stark_proof method in scroll-zkvm-verifier returns Result<(), Error> indicating success/failure, not Result<bool, Error>. When it succeeds, verification passed; when it fails, it returns an error.
Applied to files:
crates/libzkp/src/tasks/batch.rscrates/libzkp/src/proofs.rscrates/libzkp/src/tasks/bundle.rs
🧬 Code graph analysis (6)
crates/libzkp/src/tasks/batch.rs (1)
crates/libzkp/src/tasks.rs (1)
encode_task_to_witness(19-22)
crates/libzkp/src/tasks/chunk.rs (1)
crates/libzkp/src/tasks.rs (1)
encode_task_to_witness(19-22)
crates/prover-bin/src/prover.rs (4)
crates/prover-bin/src/types.rs (2)
default(62-64)default(105-107)crates/libzkp/src/lib.rs (1)
new(24-40)crates/prover-bin/src/zk_circuits_handler/universal.rs (1)
new(19-31)crates/libzkp/src/tasks.rs (1)
new(53-58)
crates/prover-bin/src/main.rs (1)
common/types/message/message.go (1)
ProofType(14-14)
crates/libzkp/src/proofs.rs (4)
coordinator/internal/types/block.go (1)
BatchInfo(4-8)common/types/message/message.go (1)
ChunkInfo(131-148)common/version/version.go (1)
Version(31-31)coordinator/internal/utils/version.go (1)
Version(16-42)
crates/libzkp/src/tasks/bundle.rs (1)
crates/libzkp/src/tasks.rs (1)
encode_task_to_witness(19-22)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: tests
🔇 Additional comments (19)
crates/libzkp/src/tasks/chunk.rs (2)
4-8: LGTM: updated chunk import path.Aligns with the new
scroll::chunkmodule layout and keeps types centralized.
117-126: LGTM: unified witness serialization.Using
encode_task_to_witnesshere keeps serialization consistent across tasks.crates/libzkp/src/tasks/batch.rs (2)
4-13: LGTM: batch/chunk imports reorganized.Keeps batch and chunk types under the unified
scrollmodule structure.
119-133: LGTM: consolidated witness encoding path.Consistent use of
encode_task_to_witnessimproves maintainability.crates/libzkp/src/tasks/bundle.rs (2)
3-7: LGTM: bundle imports aligned with new module layout.
27-40: LGTM: standardized witness serialization.crates/libzkp/src/proofs.rs (3)
6-13: Import reorganization looks good.The migration from flat paths to nested
scroll::{...}module paths aligns with the broader codebase refactoring. The types (BatchInfo,BundleInfo,ChunkInfo) are used consistently throughout the file.
216-216: Test import update is consistent.The test import aligns with the new
scroll::bundle::BundleInfopath used in the main imports.
254-254: Versioned API approach is more flexible.Using
pi_hash_by_version(version::Version::euclid_v1())instead of a specificpi_hash_euclidv1()method is a cleaner pattern that allows the same API to handle multiple protocol versions. This is consistent with thepi_hash_checkmethod on line 181 that takesversion::Versionas a parameter, and the pattern is used consistently across the codebase (chunk.rs, bundle.rs, batch.rs).tests/prover-e2e/mainnet-galileo/config.template.json (1)
13-15: LGTM — template now aligned with Galileo fork settings.Also applies to: 27-27
tests/prover-e2e/mainnet-galileo/.make.env (1)
1-3: Confirm blocks 26653680–26653686 fall within the Galileo fork activation window.The block range is consumed inclusively (7 blocks total) from the official Scroll mainnet RPC. Verify that these block numbers correspond to the Galileo fork epoch by checking against Scroll's fork activation documentation or querying actual block timestamps; otherwise, the E2E test coverage may be misleading or flaky if blocks predate the fork activation.
crates/prover-bin/Cargo.toml (1)
12-12: Verify dependency pins for scroll-proving-sdk and bincode 2.0.Please confirm the git rev
22ad34eis the intended commit and that bincode 2.0 withserdeis compatible with the new dumper serialization path.Also applies to: 37-37
crates/prover-bin/src/zk_circuits_handler/universal.rs (1)
19-27: Confirm the segment_len bump aligns with resource budgets.
segment_lenincreased to(1 << 22) - 100, which can affect memory and throughput. Please confirm this is the intended target for the OpenVM 1.4.x prover configuration and fits downstream limits.crates/prover-bin/src/prover.rs (2)
214-227: Panic propagation matches the “fail-fast” requirement.Resuming unwind on task panic will terminate the worker as intended.
294-296: Verify OpenVM 1.3 tasks are intentionally hard-rejected.
use_openvm_13now causes an immediate bail, andUniversalHandler::newno longer accepts the flag. Please confirm upstream won’t send OpenVM 1.3 tasks and that the error message is sufficient for operators.Also applies to: 323-323
crates/prover-bin/src/dumper.rs (1)
54-87: Confirm Failed status is the intended dump-mode signal.
prove()andquery_task()always returnFailedto force exit. Please verify this matches the coordinator’s expectations (no retries/alerts for dump mode).crates/libzkp/src/lib.rs (1)
24-37: Deprecation handling looks good.The explicit warnings for
legacy_witnessandopenvm_13make misconfiguration visible while keeping behavior deterministic.crates/prover-bin/src/main.rs (2)
1-6: New dumper module wiring looks fine.
36-51: TaskType → ProofType mapping is clear and complete.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Cargo.toml
Outdated
| version = "4.7.11" | ||
|
|
||
| [workspace.dependencies] | ||
| scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" } | ||
| scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" } | ||
| scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" } | ||
| # with openvm 1.4.2 | ||
| scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" } | ||
| scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" } | ||
| scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's look at the Cargo.toml file to understand the context
cd $(git rev-parse --show-toplevel 2>/dev/null || pwd)
cat -n Cargo.toml | head -30Repository: scroll-tech/scroll
Length of output: 1322
🏁 Script executed:
# Search for PR objectives, commit messages, or documentation mentioning OpenVM
rg -i "openvm.*1\.4\.[23]" --type-listRepository: scroll-tech/scroll
Length of output: 451
🏁 Script executed:
# Check if there are any PR descriptions, README, or CHANGELOG files
fd -e md -e txt | grep -iE "(readme|changelog|pr|pull|objective)" | head -20Repository: scroll-tech/scroll
Length of output: 272
🏁 Script executed:
# Look for any OpenVM version references in the entire repository
rg "openvm.*1\.4" -iRepository: scroll-tech/scroll
Length of output: 6331
Update the OpenVM version comment from 1.4.2 to 1.4.3.
The Cargo.lock file shows OpenVM 1.4.3 is the actual dependency version, but the comment on line 20 references 1.4.2. Update the comment to reflect the correct version.
Suggested fix
-# with openvm 1.4.2
+# with openvm 1.4.3📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| version = "4.7.11" | |
| [workspace.dependencies] | |
| scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" } | |
| scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" } | |
| scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" } | |
| # with openvm 1.4.2 | |
| scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" } | |
| scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" } | |
| scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" } | |
| version = "4.7.11" | |
| [workspace.dependencies] | |
| # with openvm 1.4.3 | |
| scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" } | |
| scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" } | |
| scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" } |
🤖 Prompt for AI Agents
In `@Cargo.toml` around lines 17 - 23, Update the inline comment that currently
reads "with openvm 1.4.2" to "with openvm 1.4.3" in the Cargo.toml
workspace.dependencies block so the comment matches the actual OpenVM version
recorded in Cargo.lock; locate the comment near the
scroll-zkvm-prover/scroll-zkvm-verifier/scroll-zkvm-types entries and change
only the version number in that comment.
| pub struct Dumper { | ||
| #[allow(dead_code)] | ||
| pub target_path: String, | ||
| pub json_mode: bool, |
There was a problem hiding this comment.
Honor target_path when writing dump files.
dump() always writes to the current working directory, so a CLI-specified target_path is ignored. This makes the dump output location incorrect.
🐛 Proposed fix
fn dump(&self, input_string: &str) -> eyre::Result<()> {
let task: ProvingTaskExt = serde_json::from_str(input_string)?;
let task = ProvingTask::from(task);
+ let base_dir = if self.target_path.is_empty() {
+ std::path::Path::new(".")
+ } else {
+ std::path::Path::new(&self.target_path)
+ };
+ std::fs::create_dir_all(base_dir)?;
+
if self.json_mode {
- let file = std::fs::File::create("input_task.json")?;
+ let file = std::fs::File::create(base_dir.join("input_task.json"))?;
serde_json::to_writer(std::io::BufWriter::new(file), &task)?;
} else {
// stream-encode serialized_witness to input_task.bin using bincode 2.0
- let input_file = std::fs::File::create("input_task.bin")?;
+ let input_file = std::fs::File::create(base_dir.join("input_task.bin"))?;
let mut input_writer = std::io::BufWriter::new(input_file);
bincode::encode_into_std_write(
&task.serialized_witness,
&mut input_writer,
bincode::config::standard(),
)?;
// stream-encode aggregated_proofs to agg_proofs.bin using bincode 2.0
- let agg_file = std::fs::File::create("agg_proofs.bin")?;
+ let agg_file = std::fs::File::create(base_dir.join("agg_proofs.bin"))?;
let mut agg_writer = std::io::BufWriter::new(agg_file);
for proof in &task.aggregated_proofs {
let sz = bincode::serde::encode_into_std_write(
&proof.proofs,
&mut agg_writer,
bincode::config::standard(),
)?;
println!("written {sz} bytes for proof");
}
}Also applies to: 24-39
🤖 Prompt for AI Agents
In `@crates/prover-bin/src/dumper.rs` around lines 13 - 16, The Dumper struct's
target_path is currently ignored by dump(); update the Dumper::dump (and any
related methods around lines 24-39) to use the Dumper.target_path when
creating/writing the output file: convert target_path to a Path/PathBuf, ensure
the parent directory exists (create_dir_all if needed), join the intended
filename to that path instead of using the current working directory, and
open/create the file at that joined path for writing; also preserve existing
json_mode logic and error handling when writing to the computed target path.
| #[arg(long = "json", default_value = "false")] | ||
| json_mode: bool, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's check the file at the specified lines
head -n 70 crates/prover-bin/src/main.rs | tail -n 20Repository: scroll-tech/scroll
Length of output: 464
🏁 Script executed:
# Let's also check the Cargo.toml to see which clap version is being used
cat crates/prover-bin/Cargo.toml | grep -A5 clapRepository: scroll-tech/scroll
Length of output: 255
🏁 Script executed:
# Let's look at more context around lines 60-61
sed -n '50,75p' crates/prover-bin/src/main.rsRepository: scroll-tech/scroll
Length of output: 552
🏁 Script executed:
# Let's check if there are other bool flags in the codebase and how they're defined
rg -B2 "bool," crates/prover-bin/src/main.rs | head -40Repository: scroll-tech/scroll
Length of output: 258
🏁 Script executed:
# Let's check if ArgAction is used elsewhere in the codebase
rg "ArgAction" crates/ --type rustRepository: scroll-tech/scroll
Length of output: 228
🏁 Script executed:
# Let's search for other #[arg] attributes to understand the pattern
rg "#\[arg\(" crates/prover-bin/src/main.rs -A1 -B1Repository: scroll-tech/scroll
Length of output: 528
Use action = ArgAction::SetTrue for flag-style parsing of --json.
With default_value = "false", clap 4.5 expects --json true|false. Since version in the same file uses ArgAction::SetTrue for flag-style behavior, apply the same pattern here.
🔧 Suggested change
- #[arg(long = "json", default_value = "false")]
+ #[arg(long = "json", action = ArgAction::SetTrue)]
json_mode: bool,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #[arg(long = "json", default_value = "false")] | |
| json_mode: bool, | |
| #[arg(long = "json", action = ArgAction::SetTrue)] | |
| json_mode: bool, |
🤖 Prompt for AI Agents
In `@crates/prover-bin/src/main.rs` around lines 60 - 61, Change the clap argument
for the json flag to use flag-style parsing by replacing the current
default_value usage with action = ArgAction::SetTrue for the json_mode field;
locate the json_mode field declaration in main.rs (the #[arg(long = "json",
default_value = "false")] json_mode: bool,) and update it to use #[arg(long =
"json", action = ArgAction::SetTrue)] json_mode: bool, and ensure ArgAction is
in scope (same pattern used by the version flag in this file).
| let prover = ProverBuilder::new( | ||
| sdk_config, | ||
| dumper::Dumper { | ||
| json_mode, | ||
| ..Default::default() | ||
| }, | ||
| ) | ||
| .build() | ||
| .await | ||
| .map_err(|e| eyre::eyre!("build prover fail: {e}"))?; | ||
|
|
||
| std::sync::Arc::new(prover) | ||
| .one_shot(&[task_id], task_type.into()) | ||
| .await; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's look at the specific file and lines mentioned
head -120 crates/prover-bin/src/main.rs | tail -40Repository: scroll-tech/scroll
Length of output: 1372
🏁 Script executed:
# Now let's find where one_shot is defined
rg "fn one_shot" --type rust -A 5Repository: scroll-tech/scroll
Length of output: 44
🏁 Script executed:
# Let's also search for the return type more broadly
rg "one_shot" crates/prover-bin/src/main.rs -B 2 -A 10Repository: scroll-tech/scroll
Length of output: 1455
🏁 Script executed:
# Search for one_shot method definition
fd "\.rs$" crates/ | xargs rg "fn one_shot" -B 2 -A 8Repository: scroll-tech/scroll
Length of output: 46
🏁 Script executed:
# Also search in the prover crate
find . -name "*.rs" -type f | xargs rg "fn one_shot" -B 2 -A 8 | head -50Repository: scroll-tech/scroll
Length of output: 44
🏁 Script executed:
# Try to find the type definition by looking for impl blocks or traits
rg "impl.*one_shot|trait.*Prover" -B 2 -A 10 | head -100Repository: scroll-tech/scroll
Length of output: 44
🏁 Script executed:
# Check what ProverBuilder builds to understand the prover type
rg "ProverBuilder" crates/prover-bin/src/main.rs -B 5 -A 15 | head -80Repository: scroll-tech/scroll
Length of output: 2387
🏁 Script executed:
# Let's look at the scroll_proving_sdk crate to find the one_shot definition
find . -path "*/scroll_proving_sdk/*" -name "*.rs" | head -20Repository: scroll-tech/scroll
Length of output: 44
🏁 Script executed:
# Check for prover definitions in the prover crate
find . -path "*/prover/*" -name "*.rs" -type f | head -30Repository: scroll-tech/scroll
Length of output: 44
🏁 Script executed:
# List the crates directory to understand the structure
ls -la crates/ | head -30Repository: scroll-tech/scroll
Length of output: 402
🏁 Script executed:
# Search for one_shot across all rust files more broadly
rg "fn one_shot" . --type rustRepository: scroll-tech/scroll
Length of output: 44
🏁 Script executed:
# Try to find where ProverBuilder is defined
rg "pub.*struct ProverBuilder|impl ProverBuilder" . --type rust -A 3Repository: scroll-tech/scroll
Length of output: 44
🏁 Script executed:
# Check the Cargo.toml in prover-bin to see where ProverBuilder comes from
cat crates/prover-bin/Cargo.tomlRepository: scroll-tech/scroll
Length of output: 1152
🏁 Script executed:
# Look at the entire repository structure to find scroll_proving_sdk
find . -name "*proving*" -o -name "*prover*" | grep -E "(\.rs$|\.toml$)" | head -30Repository: scroll-tech/scroll
Length of output: 95
🏁 Script executed:
# Search for scroll_proving_sdk in git ls-files
git ls-files | grep -E "scroll_proving_sdk|prover" | head -50Repository: scroll-tech/scroll
Length of output: 2303
🏁 Script executed:
# Let's check the prover.rs file in prover-bin to see how one_shot is used there
cat crates/prover-bin/src/prover.rsRepository: scroll-tech/scroll
Length of output: 12441
🏁 Script executed:
# Check imports and see if there are any type hints about one_shot
head -50 crates/prover-bin/src/main.rsRepository: scroll-tech/scroll
Length of output: 1262
Handle one_shot failures instead of ignoring the result.
The Dump command path ignores the return value of one_shot, while the Handle command path explicitly asserts on the result (indicating a bool return). This inconsistency means dump failures silently succeed. Check the return value and propagate the error to the CLI.
🔧 Suggested change
- std::sync::Arc::new(prover)
- .one_shot(&[task_id], task_type.into())
- .await;
+ let success = std::sync::Arc::new(prover)
+ .one_shot(&[task_id], task_type.into())
+ .await;
+ if !success {
+ eyre::bail!("dump failed for task_id={task_id}");
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| let prover = ProverBuilder::new( | |
| sdk_config, | |
| dumper::Dumper { | |
| json_mode, | |
| ..Default::default() | |
| }, | |
| ) | |
| .build() | |
| .await | |
| .map_err(|e| eyre::eyre!("build prover fail: {e}"))?; | |
| std::sync::Arc::new(prover) | |
| .one_shot(&[task_id], task_type.into()) | |
| .await; | |
| let prover = ProverBuilder::new( | |
| sdk_config, | |
| dumper::Dumper { | |
| json_mode, | |
| ..Default::default() | |
| }, | |
| ) | |
| .build() | |
| .await | |
| .map_err(|e| eyre::eyre!("build prover fail: {e}"))?; | |
| let success = std::sync::Arc::new(prover) | |
| .one_shot(&[task_id], task_type.into()) | |
| .await; | |
| if !success { | |
| eyre::bail!("dump failed for task_id={task_id}"); | |
| } |
🤖 Prompt for AI Agents
In `@crates/prover-bin/src/main.rs` around lines 95 - 108, The Dump command
currently calls ProverBuilder::new(...).build().await and then ignores the
boolean/result of Arc::new(prover).one_shot(&[task_id], task_type.into()).await;
modify the Dump command path to check the returned Result/bool from one_shot
(same as the Handle path does), and if it indicates failure return or propagate
an error to the CLI (e.g., map_err/eyre::eyre! or bail). Locate the call site
for one_shot in main.rs and ensure you mirror the Handle flow: inspect the
awaited value, convert it to a useful error on failure, and propagate it up
instead of discarding it.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #1783 +/- ##
===========================================
- Coverage 36.47% 36.42% -0.06%
===========================================
Files 248 248
Lines 21329 21320 -9
===========================================
- Hits 7780 7765 -15
- Misses 12720 12732 +12
+ Partials 829 823 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
rollup/tests/integration_tool/imports.go (1)
161-163:⚠️ Potential issue | 🟡 MinorClarify the
l1MsgPoppedBefore == 0log message.Line 162 says “no l1 message in target blks”, but this branch is also taken when the first L1 nonce is
0(message exists). The log is misleading during debugging.Proposed fix
- log.Info("no l1 message in target blks, no need for leading chunk") + log.Info("first l1 nonce is 0 or no l1 message found; no need for leading chunk")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rollup/tests/integration_tool/imports.go` around lines 161 - 163, The log message for the branch guarded by l1MsgPoppedBefore == 0 is misleading because that condition can be true either when there are genuinely no L1 messages in the target blocks or when the first L1 nonce is 0; update the message in the same block (where l1MsgPoppedBefore is checked) to clarify which case occurred by adding context—e.g., indicate whether the target blocks contain no L1 messages or whether the first L1 nonce is zero (or include the value of l1MsgPoppedBefore) so debugging can distinguish the two situations; modify the log.Info call referencing l1MsgPoppedBefore accordingly.
🧹 Nitpick comments (2)
coordinator/internal/utils/version.go (1)
22-27: Please add table-driven tests for this new Validium branch.Given the changed behavior and current patch coverage gap, add cases for
galileov2(success), non-supported forks (error), and mixed-case input normalization to lock this behavior down.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@coordinator/internal/utils/version.go` around lines 22 - 27, Add table-driven unit tests targeting the new Validium branch in version.go that exercises the switch on canonicalName (strings.ToLower(hardForkName)): include a case where hardForkName == "galileov2" (expect stfVersion == 1 and nil error), a case with an unsupported fork name (expect non-nil error containing "unsupported fork in validium mode" and zero version), and a mixed-case input (e.g., "GaLiLeOv2") to verify normalization via strings.ToLower; implement these as subtests in a single TestValidiumForks function using a slice of test cases and assertions against the returned stfVersion and error from the function that contains the switch (referencing canonicalName/hardForkName/stfVersion in version.go).rollup/tests/integration_tool/imports.go (1)
149-159: Add branch coverage for the two zero-return paths.Please add targeted tests for: (1) no L1 message in scanned blocks, and (2) first L1 message nonce equals
0. This refactor centralizes behavior, so explicit coverage will prevent regressions.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rollup/tests/integration_tool/imports.go` around lines 149 - 159, Add two unit tests targeting the zero-return branches of the l1MsgPoppedBefore closure: (1) construct a blks slice with transactions but no tx.Type == types.L1MessageTxType and assert l1MsgPoppedBefore returns 0, and (2) construct blks where the first encountered L1 message has tx.Nonce == 0 and assert l1MsgPoppedBefore returns 0. Locate the closure called l1MsgPoppedBefore in imports.go and reuse the same surrounding setup (beginBlk, blks, Transactions) so the new tests exercise the exact code path; assert the returned uint64 equals 0 for both cases to provide explicit branch coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@rollup/cmd/rollup_relayer/app/app.go`:
- Around line 114-116: Add unit/regression tests that exercise the new Validium
branch that checks cfg.L2Config.RelayerConfig.ValidiumMode against
minCodecVersion and encoding.CodecV10: one test where ValidiumMode=true and
minCodecVersion < encoding.CodecV10 that asserts the code path fails (e.g.,
expects log.Crit or the function to return an error/exit) and another where
ValidiumMode=true and minCodecVersion >= encoding.CodecV10 that asserts the code
path proceeds successfully. Locate the check in
rollup/cmd/rollup_relayer/app/app.go (the if using
cfg.L2Config.RelayerConfig.ValidiumMode and minCodecVersion) and add tests
(e.g., TestValidiumMinCodecVersion_Fails and TestValidiumMinCodecVersion_Passes)
that construct cfg with different minCodecVersion values and verify the
failure/success behavior.
In `@tests/prover-e2e/cloak-galileoV2/config.json`:
- Line 4: The config.json contains an inline DSN with credentials in the "dsn"
key which must be removed; replace the hard-coded value with a placeholder or
env reference (e.g. set "dsn" to a sentinel like "__ENV_DSN__" or empty) and
update the test/runtime bootstrap to read the actual connection string from an
environment variable (e.g. CLOAK_GALILEOV2_DSN) before starting tests; ensure
the change is made where "dsn" is defined in config.json and that the test
harness or setup code that creates the DB connection (the code that consumes
config.json's "dsn") is updated to throw a clear error if the env var is missing
so CI/local runs must inject the DSN securely.
---
Outside diff comments:
In `@rollup/tests/integration_tool/imports.go`:
- Around line 161-163: The log message for the branch guarded by
l1MsgPoppedBefore == 0 is misleading because that condition can be true either
when there are genuinely no L1 messages in the target blocks or when the first
L1 nonce is 0; update the message in the same block (where l1MsgPoppedBefore is
checked) to clarify which case occurred by adding context—e.g., indicate whether
the target blocks contain no L1 messages or whether the first L1 nonce is zero
(or include the value of l1MsgPoppedBefore) so debugging can distinguish the two
situations; modify the log.Info call referencing l1MsgPoppedBefore accordingly.
---
Nitpick comments:
In `@coordinator/internal/utils/version.go`:
- Around line 22-27: Add table-driven unit tests targeting the new Validium
branch in version.go that exercises the switch on canonicalName
(strings.ToLower(hardForkName)): include a case where hardForkName ==
"galileov2" (expect stfVersion == 1 and nil error), a case with an unsupported
fork name (expect non-nil error containing "unsupported fork in validium mode"
and zero version), and a mixed-case input (e.g., "GaLiLeOv2") to verify
normalization via strings.ToLower; implement these as subtests in a single
TestValidiumForks function using a slice of test cases and assertions against
the returned stfVersion and error from the function that contains the switch
(referencing canonicalName/hardForkName/stfVersion in version.go).
In `@rollup/tests/integration_tool/imports.go`:
- Around line 149-159: Add two unit tests targeting the zero-return branches of
the l1MsgPoppedBefore closure: (1) construct a blks slice with transactions but
no tx.Type == types.L1MessageTxType and assert l1MsgPoppedBefore returns 0, and
(2) construct blks where the first encountered L1 message has tx.Nonce == 0 and
assert l1MsgPoppedBefore returns 0. Locate the closure called l1MsgPoppedBefore
in imports.go and reuse the same surrounding setup (beginBlk, blks,
Transactions) so the new tests exercise the exact code path; assert the returned
uint64 equals 0 for both cases to provide explicit branch coverage.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (7)
Cargo.lockis excluded by!**/*.lockbridge-history-api/go.sumis excluded by!**/*.sumcommon/go.sumis excluded by!**/*.sumcoordinator/go.sumis excluded by!**/*.sumgo.work.sumis excluded by!**/*.sumrollup/go.sumis excluded by!**/*.sumtests/integration-test/go.sumis excluded by!**/*.sum
📒 Files selected for processing (24)
Cargo.tomlbridge-history-api/go.modcommon/go.modcommon/version/version.gocoordinator/go.modcoordinator/internal/utils/codec_validium.gocoordinator/internal/utils/version.gorollup/cmd/rollup_relayer/app/app.gorollup/go.modrollup/internal/controller/relayer/l2_relayer.gorollup/internal/utils/utils.gorollup/tests/integration_tool/imports.gotests/integration-test/go.modtests/prover-e2e/Makefiletests/prover-e2e/cloak-galileoV2/.make.envtests/prover-e2e/cloak-galileoV2/config.jsontests/prover-e2e/cloak-galileoV2/config.template.jsontests/prover-e2e/cloak-galileoV2/genesis.jsontests/prover-e2e/cloak-xen/.make.envtests/prover-e2e/cloak-xen/00100_import_blocks.sqltests/prover-e2e/cloak-xen/config.jsontests/prover-e2e/mainnet-galileo/.make.envtests/prover-e2e/sepolia-galileo/.make.envtests/prover-e2e/sepolia-galileoV2/.make.env
💤 Files with no reviewable changes (2)
- tests/prover-e2e/cloak-xen/config.json
- tests/prover-e2e/cloak-xen/.make.env
✅ Files skipped from review due to trivial changes (3)
- common/version/version.go
- rollup/internal/controller/relayer/l2_relayer.go
- tests/prover-e2e/sepolia-galileoV2/.make.env
🚧 Files skipped from review as they are similar to previous changes (2)
- Cargo.toml
- tests/prover-e2e/mainnet-galileo/.make.env
| if cfg.L2Config.RelayerConfig.ValidiumMode && minCodecVersion < encoding.CodecV10 { | ||
| log.Crit("min codec version must be greater than or equal to CodecV10 in validium mode", "minCodecVersion", minCodecVersion) | ||
| } |
There was a problem hiding this comment.
Add regression tests for the new Validium branch.
Line 114 introduces a new fail-fast path, but this branch is currently uncovered in the patch report. Please add coverage for both cases: ValidiumMode=true with < CodecV10 (fails) and >= CodecV10 (passes).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@rollup/cmd/rollup_relayer/app/app.go` around lines 114 - 116, Add
unit/regression tests that exercise the new Validium branch that checks
cfg.L2Config.RelayerConfig.ValidiumMode against minCodecVersion and
encoding.CodecV10: one test where ValidiumMode=true and minCodecVersion <
encoding.CodecV10 that asserts the code path fails (e.g., expects log.Crit or
the function to return an error/exit) and another where ValidiumMode=true and
minCodecVersion >= encoding.CodecV10 that asserts the code path proceeds
successfully. Locate the check in rollup/cmd/rollup_relayer/app/app.go (the if
using cfg.L2Config.RelayerConfig.ValidiumMode and minCodecVersion) and add tests
(e.g., TestValidiumMinCodecVersion_Fails and TestValidiumMinCodecVersion_Passes)
that construct cfg with different minCodecVersion values and verify the
failure/success behavior.
| { | ||
| "db_config": { | ||
| "driver_name": "postgres", | ||
| "dsn": "postgres://dev:dev@localhost:5432/scroll?sslmode=disable", |
There was a problem hiding this comment.
Avoid committing DSNs with inline credentials in tracked config.
Line 4 embeds username/password directly. Even test credentials tend to create secret-scanner noise and accidental reuse risk; prefer injecting the DSN via environment/runtime config.
🔧 Suggested change
- "dsn": "postgres://dev:dev@localhost:5432/scroll?sslmode=disable",
+ "dsn": "${SCROLL_PROVER_E2E_DSN}",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "dsn": "postgres://dev:dev@localhost:5432/scroll?sslmode=disable", | |
| "dsn": "${SCROLL_PROVER_E2E_DSN}", |
🧰 Tools
🪛 Checkov (3.2.334)
[medium] 4-5: Basic Auth Credentials
(CKV_SECRET_4)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/prover-e2e/cloak-galileoV2/config.json` at line 4, The config.json
contains an inline DSN with credentials in the "dsn" key which must be removed;
replace the hard-coded value with a placeholder or env reference (e.g. set "dsn"
to a sentinel like "__ENV_DSN__" or empty) and update the test/runtime bootstrap
to read the actual connection string from an environment variable (e.g.
CLOAK_GALILEOV2_DSN) before starting tests; ensure the change is made where
"dsn" is defined in config.json and that the test harness or setup code that
creates the DB connection (the code that consumes config.json's "dsn") is
updated to throw a clear error if the env var is missing so CI/local runs must
inject the DSN securely.
This PR purpose a stable version for prover after GalileoV2 forking.
This PR would replace #1774
Current status:
Summary by CodeRabbit
New Features
Refactor
Tests
Chores